{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a href=\"https://csdms.colorado.edu/wiki/ESPIn2020\"><img style=\"float: center; width: 75%\" src=\"../../media/ESPIn.png\"></a>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Advancing your science using scientific programming ##\n",
    "\n",
    "This series of notebooks is partly based on existing materials from the python software carpentry of CSDMS developed by Mark Piper, Mariela Perignon and others, and further extended and adjusted in the framework of ESPIn 2020 by Benjamin Campforts. \n",
    "\n",
    "The best way to learn how to program is to solve a scientific question,\n",
    "so this introduction to Python is built around the simulation of the spread of ash aerosols (ppm) over Iceland and the rest of Europe, produced by the Icelandic Eyjafjallajökull eruption in 2010. \n",
    "\n",
    "Our real goal isn't to teach you Python,\n",
    "but to teach you the basic concepts that all good scientific programming depends on.\n",
    "We use Python in our lessons because:\n",
    "\n",
    "1.  we have to use *something* for examples;\n",
    "2.  it's free, well-documented, and runs almost everywhere;\n",
    "3.  it has a large (and growing) user base among scientists; and\n",
    "4.  experience shows that it's easier for novices to learn than most other languages.\n",
    "\n",
    "We are using topographic as examples in this set of lessons.\n",
    "> ## Prerequisites\n",
    ">\n",
    "> Learners need to understand the concepts of files and directories\n",
    "> (including the working directory) and how to start a Python\n",
    "> interpreter before tackling this lesson. This lesson references the Jupyter (IPython)\n",
    "> Notebook, although it can be taught through any Python interpreter.\n",
    "> The commands in this lesson pertain to **Python 3.6.10**.\n",
    "\n",
    "> ## Getting ready\n",
    ">\n",
    "> Notebooks used in this session can be run on the CSDMS Jupyterhub. Alternatively, you can run them on your personal computer. \n",
    "> You need to have Python 3 installed on your computer. We recommend installing [Anaconda](https://www.anaconda.com/products/individual), then following the instructions for setting up the ESPIn `conda` environment in the [Anaconda and conda](./conda/index.md) lesson.\n",
    ">\n",
    "> You also need to download some files to follow this lesson:\n",
    ">\n",
    "> 1. Download [swc_python.zip](../../swc_python.zip) and move it to your Desktop\n",
    "> 2. If it's not unzipped yet, double-click on it to unzip it. You should end up with a new folder called `swc_python`.\n",
    "> 3. Access this folder from the Unix shell :\n",
    "> ~~~ \n",
    "> $ cd && cd Desktop/swc_python/data\n",
    "> ~~~"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## The 2010 Eyjafjallajökull volcano eruption\n",
    "“On 14 April 2010 a subglacial explosive eruption started Eyjafjallajökull, situated on the southcentral coast of Iceland. This was a medium‐size eruption but due to the explosive nature and the prevailing winds during that first week, the ash was advected southeastward into the crowded air space of the UK and continental Europe. This caused major disruptions of air traffic. Volcanic eruptions are not uncommon in Iceland but the Eyjafjallajökull eruption has shown different characteristics than usually expected. Instead of peaking during the first few days and then gradually decreasing, the eruption had an explosive phase 14–17 April with mainly tephra and ash production, and a phase of mainly lava production 18–30 April before becoming explosive again. This meant that a continuous reevaluation of the strength of the eruption and the production of tephra and ash was necessary. Because the winds carried the ash a short distance overland, only a small part of Iceland, about 3\\% , was badly affected by ash fall. However, the rural community in the vicinity of the volcano that experienced the worst ash fall is also facing problems with drifting ash.\" Guðrún Nína Petersen; Copyright © 2010 Royal Meteorological Society \n",
    "\n",
    "<figure class=\"image\">\n",
    "  <img src=\"../../media/Eya_vol.png\">\n",
    "  <figcaption> On 14 April 2010, the Eyjafjallajökull volcano became one of the most famous volcanoes in the world causing major disruption to air traffic in northern Europe.</figcaption>\n",
    "</figure>\n",
    "\n",
    "If you want to learn more about all this, [this is a nice EOS article](https://eos.org/research-spotlights/volcanic-ash-contributes-to-climate-cooling)\n",
    "\n",
    "## Goal\n",
    "Your goal for today and tomorrow will be to simulate the amount of ash aerosols (ppm) over Iceland and the rest of Europe, produced by the Eyjafjallajökull volcano in its explosive phase. Special attention will be given to the ash concentration in Brussels. Aerosols are tracer elements, transported by the wind and can be modeled as an advection diffusion system. In this exercise, the units of aerosols are parts per million (ppm). Note that this exercise is a simplified version of reality: used parameter values and concentrations are all arbitrary and merely picked for the purpose of demonstrating the advection (also referred to as convection) diffusion equation. \n",
    "\n",
    "## Topics\n",
    "Before we dive into the solution of the advection-diffusion problem posed by the volcanic eruption, we need to cover some basic python programming skills: \n",
    "### Basic python programming skills\n",
    "1.  [Numpy arrays to analyze topographic data](ESPIN-01-numpy.ipynb)\n",
    "2.  [Storing Multiple Values in Lists](ESPIN-02-lists.ipynb)\n",
    "3.  [Writing stand-alone Python scripts](ESPIN-03-scripts.ipynb)\n",
    "4.  [For loops and conditionals](ESPIN-04-%20For%20loops%20and%20conditionals.ipynb)\n",
    "\n",
    "### Scientific Programming in Python \n",
    "5.  [Scientific Programming Part 1 (Diffusion)](ESPIN-05%20Models%20Part%201%20(Diffusion).ipynb)\n",
    "6.  [Scientific Programming Part 2 (Advection)](ESPIN-06%20Models%20Part%202%20(Advection).ipynb)\n",
    "\n",
    "### Advanced python programming skills\n",
    "\n",
    "7.  [Creating Functions](ESPIN-07-func.ipynb)\n",
    "8.  [A very basic introduction to Object oriented programming](ESPIN-08-OO.ipynb)\n",
    "\n",
    "\n",
    "## Other Resources\n",
    "\n",
    "*   [Reference](reference.html)\n",
    "*   [csdms-software-carpentry](https://github.com/csdms/csdms-carpentry)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
